<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from "./chart.vue";
export default {
  props: {
    lineData: {
      type: Object,
      default: () => ({
        category: ["21/6", "21/7", "21/8", "21/9", "21/10", "21/11"],
        lineData: [
          [18092, 20728, 24045, 28348, 32808, 30808],
          [9989, 20222, 13231, 28348, 32808, 12808],
          [18092, 22728, 14045, 21348, 32808, 22808],
        ],
        barData: [4600, 5000, 5500, 6500, 7500],
        rateData: [0.25, 0.33, 0.45, 0.41, 0.22],
        linecolor: ["#16A5FF", "#FFB37B", "#7CCF72"],
        height: "20rem",
      }),
    },
  },
  data() {
    return {
      cdata: {
        category: [
          "甘州区",
          "民乐县",
          "临泽县",
          "高台县",
          "山丹县",
          "肃南裕固族自治县",
        ],
        lineData: [
          [18092, 20728, 24045, 28348, 32808, 30808],
          [9989, 20222, 13231, 28348, 32808, 12808],
          [18092, 22728, 14045, 21348, 32808, 22808],
        ],
        barData: [4600, 5000, 5500, 6500, 7500],
        rateData: [0.25, 0.33, 0.45, 0.41, 0.22],
        linecolor: ["#16A5FF", "#FFB37B", "#7CCF72"],
        height: "20rem",
      },
    };
  },
  components: {
    Chart,
  },
  mounted() {
    //this.setData();
    console.log(this.lineData, "--------------*****************");
  },
  methods: {
    // 根据自己的业务情况修改
    setData() {
      for (let i = 0; i < this.cdata.barData.length - 1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>